package com.crossriver.crgis.cofo.util;

import java.util.List;

import com.crossriver.crgis.database.model.Application_C_of_O;
import com.crossriver.crgis.database.model.Documents;
import com.crossriver.crgis.database.model.Supporting_Document;
import com.crossriver.crgis.database.service.Application_C_of_OLocalServiceUtil;
import com.crossriver.crgis.database.service.DocumentsLocalServiceUtil;
import com.crossriver.crgis.database.service.Supporting_DocumentLocalServiceUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;

public class DownloadUtil {

	public static List<Application_C_of_O> getApplications(String userId){
		List<Application_C_of_O> applications  = null;
		try {
			  applications = Application_C_of_OLocalServiceUtil.getApplication_C_of_OByUserId(userId);
		} catch (SystemException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return applications;
	}
	
	
	public static List<Supporting_Document> getSupportingDocuments(String applicationId){
		List<Supporting_Document> suppDocs  = null;
		try {
			
			suppDocs = Supporting_DocumentLocalServiceUtil.getSupporting_DocumentByApplId(applicationId);
			
		} catch (SystemException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		//DocumentsLocalServiceUtil
		return suppDocs;
	}
	
	public static  Supporting_Document  getSupportingDocument(String documentId){
		Supporting_Document  suppDoc  = null;
		try {
			
			suppDoc = Supporting_DocumentLocalServiceUtil.getSupporting_Document(documentId);
			
		} catch (PortalException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}catch (SystemException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return suppDoc;
	}
	
	public static Documents  getDocument(String documentId){
		Documents  doc  = null;
		try {
			
			doc = DocumentsLocalServiceUtil.getDocuments(documentId);
			
		} catch (PortalException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}catch (SystemException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return doc;
	}
}
